﻿$(function () {
    var icon = "<i class='fa fa-times-circle'></i> ";
    var validator = $("#mainForm").validate({
        rules: {
            State: {
                required: true,
            }
        },
        messages: {
            State: {
                required: icon + "请选择操作类型",
            }
        },
        submitHandler: function (form) {
            //进行ajax传值
            $.ajax({
                url: "/Account/OutMoneyOrders/OutMoneyOrdersOutMoneyAsync",
                type: "post",
                dataType: "json",
                data: $('#mainForm').serialize(),
                success: function (data) {
                    //Info,Success,Warning,Error
                    var type = data.type;
                    if (type == 1) {
                        layer.msg(data.content, { icon: 6, time: 2000 },
                            function () {
                                var index = parent.layer.getFrameIndex(window.name);
                                parent.layer.close(index);
                            });

                    } else {
                        layer.msg(data.content, { icon: 5, time: 2000 });
                    }
                }
            });
        }
    });

});
